
CC ?= gcc

OS := $(shell uname -s)

all: sluac

.PHONY: all $(PLATS) clean none

CFLAGS = \
	-Wall \
	-O2 \
	-Ideps/lua/include

ifeq ($(OS),Darwin)
    LIBS += -Ldeps/lua/lib/macosx
else
    LIBS += -Ldeps/lua/lib/mingw
endif
LIBS += -llua

OBJS = \
	src/base64/libbase64.o \
	src/xxtea/xxtea.o \
	src/sluac.o

sluac: $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

$(OBJS): %.o : %.c
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	-$(RM) $(OBJS) sluac{,.exe}
